package edu.fdzc.mapper;

import edu.fdzc.pojo.Clazz;
import edu.fdzc.pojo.ClazzQueryParam;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ClazzMapper {

    /**
     * 新增班级
     */
    void save(Clazz clazz);

    @Select("SELECT id, name, room, begin_date, end_date, master_id, subject, create_time,update_time from clazz order by update_time desc ")
    List<Clazz> getAllClazz();

    /**
     * 班级列表查询
     */
    List<Clazz> list(ClazzQueryParam clazzQueryParam);

    /**
     * 根据id查询班级
     */
    Clazz getById(Integer id);

    /**
     * 修改班级信息
     */
    void update(Clazz clazz);

    /**
     * 根据id删除班级信息
     */
    void deleteById(Integer id);

    int countStudentsByClazzId(Integer id);
}
